package kr.hkit.ch09;

import com.example.androidcompletelka.R;

import android.app.Activity;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.EditText;
import android.widget.TextView;

public class TextChange extends Activity {
	EditText mEdit;
	TextView tv;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.text_change);
	
		mEdit = (EditText) findViewById(R.id.edit);
		
		tv = (TextView) findViewById(R.id.text);
		mEdit.addTextChangedListener(mWatcher);
	}
	
	TextWatcher mWatcher = new TextWatcher() {
		
		@Override
		public void onTextChanged(CharSequence s, int start, int before, int count) {
			tv.setText("echo : " + s);
		}
		
		@Override
		public void beforeTextChanged(CharSequence s, int start, int count,
				int after) {
		
			
		}
		
		@Override
		public void afterTextChanged(Editable s) {
		
		}
	};
	
}
